package com.todo.member.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/2/12 13:04
 * @description
 */
@Getter
@AllArgsConstructor
public enum MemberVipTypeEnum {

    BRONZE(1, "bronze", "青铜"),
    SILVER(2, "silver", "白银"),
    GOLD(3, "GOLD", "黄金"),
    BLACK_CARD(4, "BLACK_CARD", "黑卡"),
    ;

    private static Map<Integer, MemberVipTypeEnum> typeMap = Arrays
            .stream(MemberVipTypeEnum.values())
            .collect(Collectors.toMap(MemberVipTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static MemberVipTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
